// store/language.js
import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

const state = {
	currentLanguage: 'en', //en zh
};

const mutations = {
	SET_LANGUAGE(state, language) {
		state.currentLanguage = language;
	}
};

const actions = {
	switchLanguage({
		commit
	}, language) {
		commit('SET_LANGUAGE', language);
	}
};

const getters = {
	currentLanguage: state => state.currentLanguage
};

export default new Vuex.Store({
	state,
	mutations,
	actions,
	getters
});